#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MaxSize 50

int main(void){
	char s[MaxSize];
	int i=0,top=-1;
	gets(s);
	while (s[i]){
		if (s[i]=='(' || s[i]=='{')
			top++;
		if (s[i]==')' || s[i]=='}'){
			if (top==-1 || s[i]!=s[top]){
				printf("false"); 
				break;
			}
			else
				top--;
		}
		i++;
	}
	if (top!=-1)
		printf("false"); 
	else if(!s[i])
		printf("true");
	return 0;
}
